import request from '@/utils/request'

export default {

  /**
   *  获取所有权限
   * @private
   */
  __api__getAllPermissions:()=>{
    return request({
      url:'/permissions',
      method:'get'
    })
  },

  /**
   *  修改权限
   * @param permission
   * @private
   */
  __api__updatePermission:(permission)=>{
    return request({
      url:'/permissions',
      method:'put',
      data:permission
    })
  },

  /**
   *  获取所有权限叶子节点
   * @private
   */
  __api__getAllPermissionLeafIds:()=>{
    return request({
      url:'/permissions/leaf-ids',
      method:'get'
    })
  },


  /**
   *  获取指定角色的权限ID列表
   * @param roleId
   * @private
   */
  __api__getPermissionIdsOfRole:(roleId)=>{
    return request({
      url:'/roles/'+roleId+'/permission-ids',
      method:'get'
    })
  },

  /**
   *  更新指定角色的权限列表
   * @param data
   * @private
   */
  __api__updatePermissionsOfRole:(data)=>{
    return request({
      url:'/roles/permissions',
      method:'put',
      data:data
    })
  }
}
